﻿Imports System.Data.SqlClient
Public Class FrmBuscarcli
    Private oDataAdapter As SqlDataAdapter
    Private oDataset As DataSet
    Private codigo As Integer


    Private Sub FrmBuscarcli_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' CargarDatos()

    End Sub
    Private Sub CargarDatos()
        'Abrir la conexion
        cn.Open()
        'crear adaptador
        Me.oDataAdapter = New SqlDataAdapter("SELECT nombre, direccion, telefono, celular FROM dbo.CLIENTES where nombre like'" & txtnombre.Text & "%" & "'ORDER BY nombre", cn)
        Me.oDataset = New DataSet
        'llenar con el adaptador el dataset
        Me.oDataAdapter.Fill(oDataset, "dbo.CLIENTES")
        cn.Close()
        Me.dgwclientes.DataSource = oDataset.Tables("dbo.CLIENTES")
    End Sub

    Private Sub txtnombre_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtnombre.KeyUp
        CargarDatos()
    End Sub

    Private Sub dgwclientes_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgwclientes.CellContentClick

    End Sub
End Class